package com.qdlc.p2p.biz.processor.task.pay;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import com.qdlc.p2p.biz.processor.event.WineCouponsValueEvent;
import com.qdlc.p2p.biz.processor.task.AbstractTaskProcessor;
import com.qdlc.p2p.biz.service.CollectPayService;
import com.qdlc.p2p.common.core.queue.TaskProcessorException;
import com.qdlc.p2p.common.core.queue.ValueEvent;

/**
 * PS 酒券代付
 *
 * @author ygw
 */
@Service
public class WineCouponsPayTaskProcessor extends AbstractTaskProcessor {

    /** 代付业务处理 */
    @Resource
    @Qualifier("wineCouponsPayService")
    private CollectPayService wineCouponsPayService;

    @Override
    public boolean supports(ValueEvent event) {
        return event instanceof WineCouponsValueEvent;
    }

    @Override
    public void process0(ValueEvent e) throws TaskProcessorException {
        WineCouponsValueEvent redEnvelopeValueEvent = (WineCouponsValueEvent)e;
        wineCouponsPayService.requestOrder(redEnvelopeValueEvent.getTppTradeLog());
    }
}
